package com.sayimo.maker.mall.goods.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sayimo.framework.database.mybatis.AbstractMybatisBaseDao;
import com.sayimo.framework.exception.DaoException;
import com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao;
import com.sayimo.maker.mall.goods.vo.GoodsNormsInfo;



@Repository(value="goodsNormsInfoInterfaceDao")
public class GoodsNormsInfoInterfaceImplDao extends AbstractMybatisBaseDao<GoodsNormsInfo> implements GoodsNormsInfoInterfaceDao{

	@Override
	public GoodsNormsInfo queryGoodsNormsByGoodsIdNormsValuesId(Map<String,Object> pm) throws DaoException {
		return mybatisInterfaceBaseDao.get("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.queryGoodsNormsByGoodsIdNormsValuesId", pm);
	}
	
	
	/**
	 * 
	* @Title: getAllNormsValueIdByGoodsId 
	* @Description: 根据商品ID 查询所有的规格值ID
	* @param goodsId
	* @return
	* @throws DaoException
	* @return List
	* @throws
	 */
	@Override
	public List getAllNormsValuesIdByGoodsId(Integer goodsId)
			throws DaoException {
		return this.mybatisInterfaceBaseDao.queryObject("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getAllNormsValuesIdByGoodsId", goodsId);
	}
	
	
	/**
	 * 
	* @Title: getNormsNameByNormsValueId 
	* @Description: 根据规格值ID 获取规格名称
	* @param normsValueId
	* @return
	* @throws DaoException
	* @return String
	* @throws
	 */
	@Override
	public String getNormsNameByNormsValueId(Integer normsValueId)
			throws DaoException {
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("id", normsValueId);
		return (String)this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getNormsNameByNormsValueId", map);
	}
	
	
	/**
	 * 
	* @Title: getNormsValuesInfoById 
	* @Description: 根据id查询规格值信息
	* @param id
	* @return
	* @throws DaoException
	* @return Map
	* @throws
	 */
	@Override
	public Map getNormsValuesInfoById(Integer id) throws DaoException {
		Map<String,Object> map=new HashMap<String, Object>();
		map.put("id", id);
		return (Map)this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getNormsValuesInfoById", map);
	}
	
	
	/**
	 * 
	* @Title: getNormsInfo 
	* @Description: 查询规格信息
	* @param goodsId
	* @param normsValueIds
	* @return
	* @throws DaoException
	* @return Map
	* @throws
	 */
	@Override
	public Map getNormsInfo(Integer goodsId, String normsValueIds)
			throws DaoException {
		Map map=new HashMap();
		map.put("goodsId", goodsId);
		map.put("normsValueIds", normsValueIds);
		return (Map)this.mybatisInterfaceBaseDao.getObject("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getNormsInfo", map);
	}


	@Override
	public Map getNormsValueInfoForShoppingCart(Map paramMap) throws DaoException {
		return this.mybatisInterfaceBaseDao.queryMap("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getNormsValueInfoForShoppingCart", "preferentialPrice", paramMap);
	}
	
	/** 
	  * @package com.sayimo.school.mall.module.goods.dao
	  * @author chenpy
	  * @Title:  
	  * @Description: 
	  * @param 
	  * @throws 
	  * @return String
	  * @date 2016年7月21日
	  */ 
	public String getNormsValuesById(Integer normsValueId) throws DaoException{
		Map<String, Object> paramMap = new HashMap<>();
		paramMap.put("normsValueId", normsValueId);	
		return (String) mybatisInterfaceBaseDao.getObject("com.sayimo.maker.mall.goods.dao.GoodsNormsInfoInterfaceDao.getNormsValuesById", paramMap);
	}
}

